#ifndef SAVINGACCOUNT_HH
#define SAVINGACCOUNT_HH
#include "IAccount.hh"
#include "Transaction.hh"
#include <string>
#include <vector>
// Implements savings account logic and restrictions.
namespace Bank {
    class SavingsAccount : public IAccount {
    private:
        std::string accountId;
        std::string ownerName;
        double balance;
        bool canTransferTo(IAccount* toAccount) const;

    public:
        // Constructor for SavingsAccount class
        // Initializes the account with a unique account ID, an owner name, and an optional initial balance
        // If no initial balance is provided, it defaults to 0.0
        SavingsAccount(const std::string& id, const std::string& owner, double initialBalance = 0.0);

        std::string getAccountId() const override;
        std::string getOwnerName() const override;
        std::string getFormattedBalance() const override;
        std::string getAccountType() const override;
        double getBalance() const override;
        // Transfers a specified amount to another account
        // The function checks if the transfer is valid (e.g., sufficient balance) 
        // and performs the transaction between the current account and the target account.
        // Optionally, a note can be included to describe the transfer.
        // Returns true if the transfer is successful, false otherwise.
        bool transferTo(IAccount* toAccount, double amount, const std::string& note = "") override;

        void displayInfo() const override;
        void deposit(double amount) override;
        bool withdraw(double amount) override;
        void internalDeposit(double amount);
        void receiveTransfer(double amount) override;

        void accessAccountInterface(const std::string& customerName, const std::vector<Transaction>& allTransactions) override;
    };
}
#endif



